import request from '@/utils/request'

export function getEmployeesSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

export function getEmployeesList(params) {
  return request({
    url: '/sys/user',
    params
  })
}

export function addEmployees(data) {
  return request({
    url: '/sys/user',
    data,
    method: 'post'
  })
}

export function delEmployees(id) {
  return request({
    url: '/sys/user/' + id,
    method: 'delete'
  })
}
// 批量导入
export function importEmployees(data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}
// 保存员工基本信息
export function saveUserDetailById(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

export function getPersonalDetail(id) {
  return request({
    url: `/employees/${id}/personalInfo`
  })
}

export function updatePersonal(data) {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'put',
    data
  })
}

export function getJobInfo(id) {
  return request({
    url: `/employees/${id}/jobs`
  })
}

export function updateJobInfo(data) {
  return request({
    url: `/employees/${data.userId}/jobs`,
    method: 'put',
    data
  })
}
/** *
 * 给用户分配角色
 * ***/
export function assignRoles(data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
